home *** CD-ROM | disk | FTP | other *** search
- // SybaseAdaptor.h
- // Copyright 1994, NeXT Computer, Inc.
-
- #import <eoaccess/eoaccess.h>
- #import <sybfront.h>
- #import <sybdb.h>
-
- @class SybaseAdaptor;
- @class SybaseContext;
-
- typedef enum
- {
- SybaseRegularRow,
- SybaseComputeRow,
- SybaseReturnParameterRow,
- SybaseReturnStatusRow
- } SybaseRowType;
-
- typedef enum
- {
- SybaseRowFetch,
- SybaseReturnParameterFetch,
- SybaseReturnStatusFetch,
- SybaseTerminatedFetch
- } SybaseFetchState;
-
- @interface SybaseChannel:EOAdaptorChannel
- {
- DBPROCESS *_dbProcess;
- SybaseAdaptor *_adaptor;
- SybaseContext *_adaptorContext;
- SybaseRowType _rowType;
- SybaseFetchState _fetchState;
- int _computeRowId; // only valid when _resultType == SybaseComputeRow;
- int _severityLevelToIgnore;
- NSArray *_columns;
- NSArray *_attributesForColumns;
- struct
- {
- unsigned fetchInProgress:1;
- unsigned logsErrors:1;
- unsigned logsMessages:1;
- unsigned shareDBProcesses:1;
- unsigned relinquishDBProcessAfterFetch:1;
- unsigned isOpen:1;
- unsigned _RESERVED:25;
- } _flags;
-
- @public
- struct {
- unsigned willFetchAttributes:1;
- unsigned willReturnRow:1;
- unsigned willReportMessage:1;
- unsigned willReportError:1;
- unsigned _RESERVED:28;
- } _sybaseDelegateRespondsTo;
- }
-
- - (BOOL)logsErrors;
- // YES if adaptor logs errors for this channel. logsErrors is set to YES
- // by default.
- - (void)setLogsErrors:(BOOL)yn;
- // If set to YES Sybase adaptors will log errors for this channel with
- // severity greater than severityLevelToIgnore.
-
- - (BOOL)logsMessages;
- // YES if adaptor logs messages for this channel. logsMessages is set
- // to YES by default.
- - (void)setLogsMessages:(BOOL)yn;
- // If set to YES Sybase adaptors will log messages for this channel with
- // severity greater than severityLevelToIgnore.
-
- - (int)severityLevelToIgnore;
- // Returns severity level of messages and errors that will be ignored by
- // the default error and message handling routines. The default value for
- // severityLevelToIgnore is 0.
- - (void)setSeverityLevelToIgnore:(int)severityLevel;
- // Sybase channels will ignore any messages and errors with
- // severity <= severityLevelToIgnore.
-
- - initWithAdaptorContext:(SybaseContext *)adaptorContext;
-
- @end
-
- @interface NSObject(SybaseChannelDelegation)
-
- - (NSArray *)sybaseChannel:(SybaseChannel *)channel
- willFetchAttributes:(NSArray *)attributes
- forRowOfType:(SybaseRowType)rowType
- withComputeRowId:(int)computeRowId;
- // Invoked whenever a row fetched, the delegate can return nil which
- // will cause the row to be skipped, or replace the attributes with a
- // set of attributes that is appropriate for the type of row that is
- // being fetched. Delegates can have the channel fabricate a set of
- // attributes for the current non-regular row by calling describe
- // attributes at this point.
-
- - (BOOL)sybaseChannel:(SybaseChannel *)channel
- willReturnRow:(NSDictionary *)row ofType:(SybaseRowType)rowType
- withComputeRowId:(int)computeRowId;
- // Invoked once a row has been read in an packaged into the dictionary.
- // Delegates return YES to cause the row to be returned from
- // fetchAttributes:WithZone: or they can return NO to cause the row to
- // be skipped.
-
- - (BOOL)sybaseChannel:(SybaseChannel *)channel
- willReportMessageWithNumber:(int)msgNo msgState:(int)msgState
- severity:(int)severity msgText:(char *)msgText srvname:(char *)srvname
- procname:(char *)procname lineno:(int)lineno;
-
- - (BOOL)sybaseChannel:(SybaseChannel *)channel
- willReportErrorWithNumber:(int)dbErr severity:(int)severity
- osErr:(int)osErr dbErrText:(char *)dbErrText osErrText:(char *)osErrText;
-
- @end
-
-